package net.mingsoft.basic.util;

import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;

/**
 * @author gengfa
 * @date 22/05/30
 */
public class ApplicationContextUtil {
    public static ApplicationContext applicationContext;

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public static void setApplicationContext(ApplicationContext applicationContext) {
        ApplicationContextUtil.applicationContext = applicationContext;
    }

    public static Object getObject(String name) {
        return SpringUtil.getApplicationContext().getBean(name);
    }

    public static Object getObject(Class<?> classType) {
        return SpringUtil.getApplicationContext().getBean(classType);
    }
}
